package cn.com.travelman.service.push;

import java.util.List;

import cn.com.travelman.service.push.bean.PushLinkMessage;
import cn.com.travelman.service.push.bean.PushNotificationMessage;
import cn.com.travelman.service.push.bean.PushTransmissionMessage;
import cn.com.travelman.service.push.factory.getui.PushMessageToList;
import cn.com.travelman.service.push.factory.getui.PushMessageToSingle;

public class PushManager {

	//private String master = "a02a76119b20d4e31620d7597a3b4f35";
	private String master = "Ajt767ljeB7tpaTekhxjM8";
	private String cid;
	private List<String> cidList;
	private String host = "http://sdk.open.api.igexin.com/serviceex";
	
	public void pushToSingleAsTransmission(String cid,PushLinkMessage  content){
		this.cid = cid;
		PushMessageToSingle PushMessageToSingle = new PushMessageToSingle(
				this.master, this.cid, this.host);

		boolean ret = PushMessageToSingle.pushLink(content);
		if (!ret) {

		}
	}
	
	
	public void pushToSingleAsTransmission(String cid, PushTransmissionMessage content){
		this.cid = cid ;
		PushMessageToSingle PushMessageToSingle= new PushMessageToSingle(this.master,this.cid,this.host);
		boolean ret = PushMessageToSingle.pushTransmission(content);
		
	}
	
	public void pushToSingleAsTransmission(String cid,PushNotificationMessage content){
		this.cid = cid ;
		PushMessageToSingle PushMessageToSingle= new PushMessageToSingle(this.master,this.cid,this.host);
		boolean ret = PushMessageToSingle.pushNotification(content);
	}
	
	
	
	
	
	public void pushToListAsTransmission(List<String> cidList, PushTransmissionMessage content){
		this.cidList = cidList ;
		PushMessageToList PushMessageToList= new PushMessageToList(this.master,cidList,this.host);
		boolean ret = PushMessageToList.pushTransmission(content);
		if (!ret){
			
		}
	}
	
	public void pushToListAsTransmission(List<String> cidList,PushLinkMessage content){
		this.cidList = cidList ;
		PushMessageToList PushMessageToList= new PushMessageToList(this.master,cidList,this.host);
		boolean ret = PushMessageToList.pushLink(content);
	}
	
	
	public void pushToListAsNotification(List<String> cidList,PushNotificationMessage content){
		this.cidList = cidList ;
		PushMessageToList PushMessageToList= new PushMessageToList(this.master,cidList,this.host);
		boolean ret = PushMessageToList.pushNotification(content);
		
	}
	
}
